package com.waitingresult.designpattern.behavioral.strategy.enums;

/**
 * All right reserved,Designed By WangShuai
 *
 * @author : WangShuai
 * @version : V1.0
 * @ClassName : StrategyMain
 * @Description : 策略模式方法类
 * @date : 2022/9/15 21:36
 */
public class StrategyMain {
    /**
     * 当前需求，
     * 当前需要根据类型， 去执行不同返回逻辑的代码
     */

    public static void main(String[] args) {
       // ControllerDemo1("Tow");
        //ControllerDemo2("One");
        ControllerDemo3("One");

    }

    private static void ControllerDemo1(String name) {
        BizStrategy strategyByName = StrategyEnum01.getStrategyByName(name);
        strategyByName.sout();
    }

    private static void ControllerDemo2(String name) {
        BizStrategy strategyByName = StrategyEnum02.getEnum(name);
        strategyByName.sout();
    }
    private static void ControllerDemo3(String name) {
        StrategyEnum03 anEnum = StrategyEnum03.getEnum(name);
        Class bizStrategy = anEnum.getBizStrategy();
        boolean instance = bizStrategy.isInstance(StrategyTow.class);
        System.err.println("instance:"+instance);
        System.err.println(bizStrategy);
    }
}
